{extend name="public/world"}
{block name="title"}修改资产{/block}
{block name="style"}
<style type="text/css">
.layui-form-item {
    margin-bottom: 0px;
}
.layui-form-label {width:110px;}
.layui-form-select dl {max-height: 220px;}
.layui-form-select dl dd, .layui-form-select dl dt {
    line-height: 26px;
}
</style>
{/block}
{block name="container"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
    <div class="layui-card" style="padding: 15px 0 0 0;height:430px;">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">资产名称</label>
                <div class="layui-input-inline" style="width: 544px;">
                    <input type="text" name="name" value="{$asset.name}" lay-verify="required" placeholder="请输入资产名称" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">购进日期</label>
                <div class="layui-input-inline">
                    <input type="text" name="buy_at" value="{$asset.buy_at}" lay-verify="required" placeholder="购进日期" autocomplete="off" id="laydate-start" lay-key="1" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">购进原价</label>
                <div class="layui-input-inline" style="width: 160px;margin-right: 5px;">
                    <input type="text" name="price" value="{$asset.price}" lay-verify="number" placeholder="请输入购进原价" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">元</div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">使用部门</label>
                <div class="layui-input-inline">
                    <select name="group" lay-verify="required" lay-search>
                        <option value="">请选择部门</option>
                        <option value="0"{if $asset.group == 0} selected{/if}>不分部门</option>
                        {volist name="groups" id="group"}
                        <option value="{$key}"{if $asset.group == $key} selected{/if}>{$group}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">借方科目</label>
                <div class="layui-input-inline">
                    <input type="text" name="to_code" id="tree_name" lay-filter="tree_name"  value="{$asset.to_code}" lay-verify="required" placeholder="请选择借方科目" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">规格说明</label>
                <div class="layui-input-inline" style="width: 544px;">
                    <input type="text" name="market" value="{$asset.market}" placeholder="请输入规格说明" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">使用期限</label>
                <div class="layui-input-inline" style="width: 160px;margin-right: 5px;">
                    <input type="text" name="month" value="{$asset.month}" lay-verify="number" placeholder="请输入使用期限" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">个月</div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">已折期数</label>
                <div class="layui-input-inline" style="width: 160px;margin-right: 5px;">
                    <input type="text" name="old_month" value="{$asset.old_month}" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">个月</div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label label-required">残值率</label>
                <div class="layui-input-inline" style="width: 160px;">
                    <input type="text" name="salvage" value="{$asset.salvage}" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">%</div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label label-required">残值小数位</label>
                <div class="layui-input-inline" style="width: 80px;margin-right: 5px;">
                    <input type="text" name="float" value="6" lay-verify="number" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">位 调整四舍五入差额</div>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-front-submit" id="LAY-front-submit" value="确认">
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    //JavaScript代码区域
    layui.use(['form', 'treeSelect', 'laydate'], function() {
        var $ = layui.$
            , treeSelect = layui.treeSelect
            , laydate = layui.laydate
            , form = layui.form;
        treeSelect.render({
            // 选择器
            elem: '#tree_name',
            // 数据
            data: "{:url('/erp.BasicsSubject/public_get_tree')}",
            // 异步加载方式：get/post，默认get
            type: 'post',
            // 占位符
            placeholder: '请选择会计科目',
            // 是否开启搜索功能：true/false，默认false
            search: true,
            // 点击回调
            click: function(d){
                $('#tree_name').val(d.current.code);
            },
            // 加载完成后的回调函数
            success: function (d) {
                // 选中节点，根据id筛选
                {if $asset.to_code}
                treeSelect.checkNode('tree_name', {$asset['to_code']});
                {/if}
            }
        });
        //开始日期
        var insStart = laydate.render({
            elem: '#laydate-start'
            ,min: '2018-01-01'
            ,type: 'date'
            //,value: new Date()
            ,done: function(value, date){
            }
        });
    });
</script>
{/block}